package com.currency.admin.pojo.dto;

import com.currency.admin.pojo.entity.SysOauthClient;
import lombok.Data;

/**
 * @author Lan
 * @date 2021/12/14
 */
@Data
public class OAuthClientFeignDTO {

    private String clientId;

    private String resourceIds;

    private String clientSecret;

    private String scope;

    private String authorizedGrantTypes;

    private String webServerRedirectUri;

    private String authorities;

    private Integer accessTokenValidity;

    private Integer refreshTokenValidity;

    private String additionalInformation;

    private String autoapprove;

    public static OAuthClientFeignDTO from(SysOauthClient oauthClient) {
        OAuthClientFeignDTO oAuthClientFeignDTO = new OAuthClientFeignDTO();
        oAuthClientFeignDTO.clientId = oauthClient.getClientId();
        oAuthClientFeignDTO.resourceIds = oauthClient.getResourceIds();
        oAuthClientFeignDTO.clientSecret = oauthClient.getClientSecret();
        oAuthClientFeignDTO.scope = oauthClient.getScope();
        oAuthClientFeignDTO.authorizedGrantTypes = oauthClient.getAuthorizedGrantTypes();
        oAuthClientFeignDTO.webServerRedirectUri = oauthClient.getWebServerRedirectUri();
        oAuthClientFeignDTO.authorities = oauthClient.getAuthorities();
        oAuthClientFeignDTO.accessTokenValidity = oauthClient.getAccessTokenValidity();
        oAuthClientFeignDTO.refreshTokenValidity = oauthClient.getRefreshTokenValidity();
        oAuthClientFeignDTO.additionalInformation = oauthClient.getAdditionalInformation();
        oAuthClientFeignDTO.autoapprove = oauthClient.getAutoapprove();
        return oAuthClientFeignDTO;
    }
}
